<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Stone\Core;
use Stone\Core\Config;
use Stone\Library\Exception;

/**
 * Description of Route
 *
 * @author Administrator
 */
class Route {
    /**
     * 检查url是查有问题
     * @return boolean
     */
    static public function check() {  
        //throw new Exception("route_error");
        //APP路径
        define("APP_PATH", ROOT_PATH . \Stone\Core\Route::getModel() . DIRECTORY_SEPARATOR );
        return true;
    }
    
    /**
     * 猎取Controller
     * @param type $param
     */
    static public function getModel() {    
        return isset($_REQUEST['m']) ? ucfirst(strtolower( $_REQUEST['m'])) :ucfirst(strtolower( C('MODEL') ));
    }
    /**
     * 猎取Controller
     * @param type $param
     */
    static public function getController() {
        return isset($_REQUEST['c']) ? ucfirst(strtolower($_REQUEST['c'])) : ucfirst(strtolower(C('CONTROLLER')));
    }
    /**
     * 猎取ACTION
     */
    static public function getAction() {
        return isset($_REQUEST['a']) ? ucfirst(strtolower($_REQUEST['a'])) :ucfirst(strtolower( C('ACTION') ));
    }
    
}
